home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.io.IOException;
- import java.io.ObjectOutputStream;
- import javax.accessibility.AccessibleContext;
- import javax.swing.text.BadLocationException;
- import javax.swing.text.Document;
- import javax.swing.text.JTextComponent;
- import javax.swing.text.Segment;
-
- public class JPasswordField extends JTextField {
- private static final String uiClassID = "PasswordFieldUI";
- private char echoChar;
-
- public JPasswordField() {
- this((Document)null, (String)null, 0);
- }
-
- public JPasswordField(int var1) {
- this((Document)null, (String)null, var1);
- }
-
- public JPasswordField(String var1) {
- this((Document)null, var1, 0);
- }
-
- public JPasswordField(String var1, int var2) {
- this((Document)null, var1, var2);
- }
-
- public JPasswordField(Document var1, String var2, int var3) {
- super(var1, var2, var3);
- this.echoChar = '*';
- }
-
- public void copy() {
- ((Component)this).getToolkit().beep();
- }
-
- public void cut() {
- ((Component)this).getToolkit().beep();
- }
-
- public boolean echoCharIsSet() {
- return this.echoChar != 0;
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJPasswordField(this);
- }
-
- return super.accessibleContext;
- }
-
- public char getEchoChar() {
- return this.echoChar;
- }
-
- public char[] getPassword() {
- Document var1 = ((JTextComponent)this).getDocument();
- Segment var2 = new Segment();
-
- try {
- var1.getText(0, var1.getLength(), var2);
- } catch (BadLocationException var4) {
- return null;
- }
-
- char[] var3 = new char[var2.count];
- System.arraycopy(var2.array, var2.offset, var3, 0, var2.count);
- return var3;
- }
-
- /** @deprecated */
- public String getText() {
- return super.getText();
- }
-
- /** @deprecated */
- public String getText(int var1, int var2) throws BadLocationException {
- return super.getText(var1, var2);
- }
-
- public String getUIClassID() {
- return "PasswordFieldUI";
- }
-
- protected String paramString() {
- return super.paramString() + ",echoChar=" + this.echoChar;
- }
-
- public void setEchoChar(char var1) {
- this.echoChar = var1;
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- var1.defaultWriteObject();
- if (super.ui != null && this.getUIClassID().equals("PasswordFieldUI")) {
- super.ui.installUI(this);
- }
-
- }
- }
-